home *** CD-ROM | disk | FTP | other *** search
- public class DynaButtonsComp extends ComponentApp {
- int backgroundStyle;
- DAssetManager assMan;
- int upID;
- int downID;
- String Orientation = "";
- String ButtonImage = "";
- String HighliteImage = "";
- String paramButtonImage = "";
- String paramHighliteImage = "";
- int backgroundColor;
- String backgroundImage = "";
- String paramBackgroundImage = "";
- int textJustification;
- int textAlignment;
- int fontColor;
- int highliteFontColor;
- String buttonFont = "";
- boolean italic;
- boolean bold;
- int fontSize;
- ButtonObject buttonList;
- DDrawJava theJavaApplet;
- String compImage = "";
- int imgX;
- int imgY;
- String indent = " ";
- // $FF: renamed from: cb java.lang.String
- String field_0;
-
- protected void RemoveAssets() {
- if (this.upID != 0) {
- this.assMan.RemoveAsset(this.upID);
- this.assMan.RemoveAsset(this.downID);
- }
-
- this.upID = 0;
- this.downID = 0;
- }
-
- public String PropertyListener(String var1, String var2, int var3, int var4, IDInspector var5) {
- if (var3 == 1) {
- if (var1.compareTo("Orientation") == 0) {
- if (this.Orientation.compareTo("Horizontal") == 0) {
- return "0";
- }
-
- return "1";
- }
-
- if (var1.compareTo("Number of Buttons") == 0) {
- return Integer.toString(this.countButtons(this.buttonList));
- }
-
- ButtonObject var6 = this.buttonList.getNext();
-
- for(int var7 = 1; var6 != null; ++var7) {
- if (var1.compareTo("Use Sub-Buttons " + var7) == 0) {
- if (var6.getSubButtonsExist()) {
- return "0";
- }
-
- return "1";
- }
-
- if (var1.compareTo("Button " + var7) == 0) {
- if (var6.getSubButtonsExist()) {
- return var6.getText();
- }
-
- return var6.getID();
- }
-
- ButtonObject var8 = var6.getSubButtons();
- if (var1.compareTo("Number Sub-Buttons " + var7) == 0) {
- return Integer.toString(this.countButtons(var8));
- }
-
- var8 = var8.getNext();
-
- for(int var9 = 1; var8 != null; ++var9) {
- if (var1.compareTo(this.indent + "Sub-Button " + var7 + "," + var9) == 0) {
- return var8.getID();
- }
-
- var8 = var8.getNext();
- }
-
- var6 = var6.getNext();
- }
- } else {
- if (var1.compareTo("Orientation") == 0) {
- if (var2.compareTo("0") == 0) {
- this.Orientation = "Horizontal";
- } else {
- this.Orientation = "Vertical";
- }
-
- this.debug("\r\nrandom:");
- this.checkList(this.buttonList);
- this.modifyImageSize();
- } else if (var1.compareTo("Number of Buttons") == 0) {
- int var12 = Integer.parseInt(var2, 10);
- if (var12 > 20) {
- var12 = 20;
- }
-
- this.modifyNumButtons(var12, this.buttonList);
- this.modifyImageSize();
- } else {
- ButtonObject var11 = this.buttonList.getNext();
-
- for(int var13 = 1; var11 != null; ++var13) {
- if (var1.compareTo("Button " + var13) == 0) {
- if (var11.getSubButtonsExist()) {
- var11.setText(var2);
- } else {
- var11.setID(var2);
- var11.setText(this.assMan.GetAssetName(Integer.parseInt(var2, 10)));
- }
- } else if (var1.compareTo("Use Sub-Buttons " + var13) == 0) {
- if (var2.compareTo("0") == 0) {
- var11.setSubButtonsExist(true);
- if (var5 != null) {
- var5.OnPropertyChanged(-1);
- }
- } else {
- var11.setSubButtonsExist(false);
- if (var5 != null) {
- var5.OnPropertyChanged(-1);
- }
- }
-
- this.modifyImageSize();
- } else if (var1.compareTo("Number Sub-Buttons " + var13) == 0) {
- int var16 = Integer.parseInt(var2, 10);
- if (var16 > 20) {
- var16 = 20;
- }
-
- this.modifyNumButtons(var16, var11.getSubButtons());
- this.modifyImageSize();
- } else {
- ButtonObject var15 = var11.getSubButtons().getNext();
-
- for(int var17 = 1; var15 != null; ++var17) {
- if (var1.compareTo(this.indent + "Sub-Button " + var13 + "," + var17) == 0) {
- var15.setID(var2);
- var15.setText(this.assMan.GetAssetName(Integer.parseInt(var2, 10)));
- }
-
- var15 = var15.getNext();
- }
- }
-
- var11 = var11.getNext();
- }
- }
-
- this.SetPropertyValues();
- }
-
- return "";
- }
-
- private void updateSiteLook(int var1) {
- IDLayout var2 = this.theJavaApplet.getLayout();
- IDSite var3 = var2.getSite();
- IDStyle var4 = var3.getCurrentStyle();
- this.backgroundStyle = var2.getBackgroundStyle();
- if (this.backgroundStyle != 0) {
- if (this.backgroundStyle == 1) {
- this.backgroundColor = var2.getBackgroundColor();
- } else if (this.backgroundStyle == 2) {
- int var5 = this.assMan.AddAsset(var2.getBackgroundImage(), "Image\u0000", "");
- this.backgroundImage = this.assMan.GetAssetRelativeLocation(var5, var1, 1);
- }
- } else {
- this.backgroundStyle = var4.getBackgroundStyle();
- if (this.backgroundStyle == 1) {
- this.backgroundColor = var4.getBackgroundColor();
- } else if (this.backgroundStyle == 2) {
- int var10 = this.assMan.AddAsset(var4.getBackgroundImage(), "Image\u0000", "");
- this.backgroundImage = this.assMan.GetAssetRelativeLocation(var10, var1, 1);
- }
- }
-
- this.textJustification = 5;
- this.textAlignment = var4.getButtonTextAlign();
- this.fontColor = var4.getButtonFontColor();
- this.highliteFontColor = var4.getButtonDownFontColor();
- IDFont var11 = var4.getButtonFont();
- this.buttonFont = var11.getName();
- this.fontSize = var11.getPoint();
- this.bold = var11.getBold();
- this.italic = var11.getItalic();
- String var6 = var4.getButtonUpImage();
- if (var6 == null || var6.compareTo("") == 0) {
- var6 = this.field_0 + "transButton.gif";
- }
-
- String var7 = var4.getButtonDownImage();
- if (var7 == null || var7.compareTo("") == 0) {
- var7 = this.field_0 + "transButton.gif";
- }
-
- this.RemoveAssets();
- this.upID = this.assMan.AddAsset(var6, "Image\u0000", "");
- this.downID = this.assMan.AddAsset(var7, "Image\u0000", "");
- this.ButtonImage = this.assMan.GetAssetRelativeLocation(this.upID, var1, 1);
- this.HighliteImage = this.assMan.GetAssetRelativeLocation(this.downID, var1, 1);
- IDSize var8 = var4.getButtonSize();
- if (var8 != null) {
- this.imgX = var8.getWidth();
- this.imgY = var8.getHeight();
- } else {
- this.imgX = 100;
- this.imgY = 35;
- }
-
- this.modifyImageSize();
- }
-
- void checkList(ButtonObject var1) {
- }
-
- public void onCopy() {
- this.debug("in onCopy()");
- this.Orientation = new String(this.Orientation);
- this.ButtonImage = new String(this.ButtonImage);
- this.HighliteImage = new String(this.HighliteImage);
- this.paramButtonImage = new String(this.paramButtonImage);
- this.paramHighliteImage = new String(this.paramHighliteImage);
- this.backgroundImage = new String(this.backgroundImage);
- this.buttonFont = new String(this.buttonFont);
- this.compImage = new String(this.compImage);
- this.indent = new String(this.indent);
- this.assMan.CopyAsset(this.upID);
- this.assMan.CopyAsset(this.downID);
- ButtonObject var1 = new ButtonObject();
- ButtonObject var2 = var1;
- this.debug("<copy> length of original: " + this.countButtons(this.buttonList));
- ButtonObject var3 = this.buttonList.getNext();
- this.debug("about to copy list");
-
- for(int var4 = 1; var3 != null; ++var4) {
- this.debug("in copy list");
- var2.setNext(new ButtonObject());
- var2 = var2.getNext();
- var2.setID(var3.getID());
- var2.setText(var3.getText());
- var2.setURL(var3.getURL());
- this.debug("copied: " + var4);
- if (var3.getSubButtonsExist()) {
- var2.setSubButtonsExist(true);
- ButtonObject var5 = var3.getSubButtons().getNext();
- ButtonObject var6 = var2.getSubButtons();
-
- for(int var7 = 1; var5 != null; ++var7) {
- var6.setNext(new ButtonObject());
- var6 = var6.getNext();
- var6.setID(var5.getID());
- var6.setText(var5.getText());
- var6.setURL(var5.getURL());
- var5 = var5.getNext();
- }
- }
-
- var3 = var3.getNext();
- }
-
- this.buttonList = var1;
- }
-
- private void modifyNumButtons(int var1, ButtonObject var2) {
- int var3 = this.countButtons(var2);
- if (var1 < var3) {
- for(int var4 = 0; var4 < var1; ++var4) {
- var2 = var2.getNext();
- }
-
- var2.setNext((ButtonObject)null);
- } else if (var1 > var3) {
- for(int var6 = 0; var6 < var1; ++var6) {
- if (var2.getNext() == null) {
- var2.setNext(new ButtonObject());
- }
-
- var2 = var2.getNext();
- }
- }
-
- }
-
- private int countButtons(ButtonObject var1) {
- int var2 = 0;
-
- for(ButtonObject var3 = var1.getNext(); var3 != null; var3 = var3.getNext()) {
- ++var2;
- }
-
- return var2;
- }
-
- public String onInstall(DAssetManager var1, String var2) {
- this.assMan = var1;
- this.compImage = var2 + "DYNBUTTON.gif";
- return "DynaButtons";
- }
-
- protected void finalize() {
- this.RemoveAssets();
- }
-
- public void onPublish(DAssetManager var1, int var2) {
- this.updateSiteLook(var2);
- this.setAllUrls(var2);
- if (var2 == 1) {
- this.paramButtonImage = "file:///" + this.ButtonImage;
- this.paramHighliteImage = "file:///" + this.HighliteImage;
- this.paramBackgroundImage = "file:///" + this.backgroundImage;
- } else {
- this.paramButtonImage = this.ButtonImage;
- this.paramHighliteImage = this.HighliteImage;
- this.paramBackgroundImage = this.backgroundImage;
- }
-
- this.SetPropertyValues();
- IDRect var3 = this.theJavaApplet.getObjectRect();
- this.theJavaApplet.AddParam("X Position", "String\u0000", Integer.toString(var3.getLeft()));
- this.theJavaApplet.AddParam("Y Position", "String\u0000", Integer.toString(var3.getTop() + 7));
- }
-
- public void onDrop(IDLayout var1, IDRect var2, int var3) {
- if (var3 == 1) {
- this.theJavaApplet = new DDrawJava();
- this.theJavaApplet.SetStyle(1, 1);
- this.theJavaApplet.setStretch(2);
- this.buttonList = new ButtonObject();
- this.buttonList.setNext(new ButtonObject());
- this.theJavaApplet.SetPositionRect(var2.getLeft(), var2.getTop(), var2.getLeft(), var2.getTop());
- this.Orientation = "Horizontal";
- this.theJavaApplet.setImageFile(this.compImage);
- this.theJavaApplet.setUsePictureText(true);
- this.theJavaApplet.setPictureText("DynaButtons");
- this.field_0 = this.theJavaApplet.getCodeBase();
- this.theJavaApplet.setAppletFileName(this.field_0 + "DynaButtons.class");
- this.theJavaApplet.AddAdditionalAppletFile(this.field_0 + "PopButton.class");
- this.theJavaApplet.AddAdditionalAppletFile(this.field_0 + "PopObject.class");
- this.theJavaApplet.AddAdditionalAppletFile(this.field_0 + "DynaButtons.cab");
- var1.AddObject(this.theJavaApplet);
- }
-
- if (var3 != 3 && var3 != 4) {
- this.updateSiteLook(0);
- this.SetPropertyValues();
- }
-
- }
-
- private void modifyImageSize() {
- int var1 = 0;
- int var2 = 0;
- ButtonObject var3 = this.buttonList.getNext();
- if (this.Orientation.compareTo("Horizontal") == 0) {
- for(var1 = this.countButtons(this.buttonList); var3 != null; var3 = var3.getNext()) {
- if (var2 == 0) {
- var2 = 1;
- }
-
- if (var3.getSubButtonsExist()) {
- int var4 = this.countButtons(var3.getSubButtons()) + 1;
- if (var4 > var2) {
- var2 = var4;
- }
- }
- }
- } else {
- var2 = this.countButtons(this.buttonList);
-
- for(int var7 = 1; var3 != null; ++var7) {
- if (var1 == 0) {
- var1 = 1;
- }
-
- if (var3.getSubButtonsExist()) {
- var1 = 2;
- int var5 = this.countButtons(var3.getSubButtons()) + var7;
- if (var5 > var2) {
- var2 = var5;
- }
- }
-
- var3 = var3.getNext();
- }
- }
-
- this.theJavaApplet.SetSize(var1 * this.imgX, var2 * this.imgY);
- }
-
- public void onInspect(CStringArray var1, CStringArray var2) {
- var1.Set("Orientation");
- var2.Set("Set(Horizontal|Vertical)");
- var1.Set("Number of Buttons");
- var2.Set("Collection\u0000");
- ButtonObject var3 = this.buttonList.getNext();
-
- for(int var4 = 1; var3 != null; ++var4) {
- if (var3.getSubButtonsExist()) {
- var1.Set("Button " + var4);
- var2.Set("String\u0000");
- var1.Set("Use Sub-Buttons " + var4);
- var2.Set("Set(Yes|No)");
- var1.Set("Number Sub-Buttons " + var4);
- var2.Set("Collection\u0000");
- ButtonObject var5 = var3.getSubButtons().getNext();
-
- for(int var6 = 1; var5 != null; ++var6) {
- var1.Set(this.indent + "Sub-Button " + var4 + "," + var6);
- var2.Set("Link\u0000");
- var5 = var5.getNext();
- }
- } else {
- var1.Set("Button " + var4);
- var2.Set("Link\u0000");
- var1.Set("Use Sub-Buttons " + var4);
- var2.Set("Set(Yes|No)");
- }
-
- var3 = var3.getNext();
- }
-
- }
-
- private void debug(String var1) {
- }
-
- private void setAllUrls(int var1) {
- ButtonObject var2 = this.buttonList.getNext();
-
- for(int var3 = 1; var2 != null; ++var3) {
- String var4 = this.assMan.GetAssetRelativeLocation(Integer.parseInt(var2.getID(), 10), var1, 1);
- var2.setURL(var4);
- if (var2.getSubButtonsExist()) {
- ButtonObject var5 = var2.getSubButtons().getNext();
-
- for(int var6 = 1; var5 != null; ++var6) {
- String var7 = this.assMan.GetAssetRelativeLocation(Integer.parseInt(var5.getID(), 10), var1, 1);
- var5.setURL(var7);
- var5 = var5.getNext();
- }
- }
-
- var2 = var2.getNext();
- }
-
- }
-
- void SetPropertyValues() {
- this.theJavaApplet.ResetParams();
- this.theJavaApplet.setHTMLBetween("ARCHIVE=DynaButtons.zip");
- this.theJavaApplet.AddParam("cabbase", "String\u0000", "DynaButtons.cab");
- this.theJavaApplet.AddParam("Orientation", "String\u0000", this.Orientation);
- this.theJavaApplet.AddParam("ButtonImage", "String\u0000", this.paramButtonImage);
- this.theJavaApplet.AddParam("HighliteImage", "String\u0000", this.paramHighliteImage);
- this.theJavaApplet.AddParam("TextJustification", "String\u0000", Integer.toString(this.textJustification));
- this.theJavaApplet.AddParam("TextAlignment", "String\u0000", Integer.toString(this.textAlignment));
- this.theJavaApplet.AddParam("ButtonFont", "String\u0000", this.buttonFont);
- this.theJavaApplet.AddParam("FontSize", "String\u0000", Integer.toString(this.fontSize));
- this.theJavaApplet.AddParam("FontColor", "String\u0000", Integer.toString(this.fontColor));
- this.theJavaApplet.AddParam("HighliteFontColor", "String\u0000", Integer.toString(this.highliteFontColor));
- if (this.bold) {
- this.theJavaApplet.AddParam("Bold", "String\u0000", "True");
- }
-
- if (this.italic) {
- this.theJavaApplet.AddParam("Italic", "String\u0000", "True");
- }
-
- if (this.backgroundStyle == 1) {
- this.theJavaApplet.AddParam("BackgroundColor", "String\u0000", Integer.toString(this.backgroundColor));
- } else if (this.backgroundStyle == 2) {
- this.theJavaApplet.AddParam("BackgroundImage", "String\u0000", this.paramBackgroundImage);
- }
-
- ButtonObject var1 = this.buttonList.getNext();
-
- for(int var2 = 0; var1 != null; ++var2) {
- if (var1.getSubButtonsExist()) {
- if (var1.getText().compareTo("") == 0) {
- this.theJavaApplet.AddParam("ButtonText" + var2, "String\u0000", " ");
- } else {
- this.theJavaApplet.AddParam("ButtonText" + var2, "String\u0000", var1.getText());
- }
-
- ButtonObject var6 = var1.getSubButtons().getNext();
-
- for(int var4 = 0; var6 != null; ++var4) {
- if (var6.getText().compareTo("") == 0) {
- this.theJavaApplet.AddParam("ButtonText" + var2 + "_" + var4, "String\u0000", " ");
- this.theJavaApplet.AddParam("URL" + var2 + "_" + var4, "String\u0000", " ");
- } else {
- this.theJavaApplet.AddParam("ButtonText" + var2 + "_" + var4, "String\u0000", var6.getText());
- this.theJavaApplet.AddParam("URL" + var2 + "_" + var4, "String\u0000", var6.getURL());
- }
-
- var6 = var6.getNext();
- }
- } else {
- if (var1.getText().compareTo("") == 0) {
- this.theJavaApplet.AddParam("ButtonText" + var2, "String\u0000", " ");
- } else {
- String var3 = this.assMan.GetAssetName(Integer.parseInt(var1.getID(), 10));
- this.theJavaApplet.AddParam("ButtonText" + var2, "String\u0000", var3);
- }
-
- this.theJavaApplet.AddParam("URL" + var2, "String\u0000", var1.getURL());
- }
-
- var1 = var1.getNext();
- }
-
- }
- }
-